Skip to content

refactor: migrate building blocks to meshstack_building_block#215

Merged
grubmeshi merged 5 commits into
mainfrom
feature/migrate-to-building-block-v3
Jul 7, 2026
Merged

refactor: migrate building blocks to meshstack_building_block#215
grubmeshi merged 5 commits into
mainfrom
feature/migrate-to-building-block-v3

Conversation

@grubmeshi

@grubmeshi grubmeshi commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

What

Migrate the hub off the deprecated meshstack_building_block_v2 resource onto meshstack_building_block.

Why

meshstack_building_block is the recommended resource: it updates inputs, display name and the
definition version in place (PUT + trigger-run) instead of the meshstack_building_block_v2
destroy-and-recreate, and unifies inputs under a single value = jsonencode(...).

Changes

  • Starterkit building blocks (aks, azure-virtual-machine, ske): child blocks migrated
    with moved {} blocks so live blocks move in place — no destroy/recreate. Verified
    end-to-end against a live SKE Starterkit instance: the git-repository + forgejo-connector child
    blocks migrated with Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
  • e2e harnesses (azure, meshstack, ske, stackit): resource + assertions switched over. No
    moved {} (ephemeral test state).
  • Provider constraint bumped to >= 0.23.0 on touched modules; READMEs regenerated; e2e-test
    skill updated to match.

moved {} blocks are kept indefinitely. They are inert once a live instance has re-run on
the new version; removing them would risk a destroy/recreate for any instance still on v2.

Deferred: aws/agentic-coding-sandbox

This module uses meshstack_buildingblock (v1) + meshstack_tenant (v1). Migrating its child
blocks to meshstack_building_block is entangled with a meshstack_tenantmeshstack_tenant_v4
upgrade (v3 target_ref needs the tenant uuid/ref), and no moved {} can bridge two
different resource types
— so that path is an unavoidable destroy/recreate of the sandbox tenant
and its cloud resources. This module is therefore left unchanged in this PR and will be migrated
separately once meshstack_tenant_v4 is GA with a proper tenant migration path. This keeps the
present PR fully non-breaking.

Migration rules applied

  • Inputs: value_<type> = Xvalue = jsonencode(X); sensitive → sensitive = { secret_value = X }.
  • CODE inputs double-encode (jsonencode(jsonencode({...}))) per the terraform-runner contract.
  • Outputs: .value_<type>jsondecode(...value) (CODE/JSON outputs decode twice).
  • Conditional inputs are conditionally included via merge() rather than
    value = jsonencode(cond ? x : null) — the latter sends an explicit JSON null, whereas v2's
    value_string = null omitted the input. Applied to azure-virtual-machine's OS-specific
    ssh_public_key / admin_password.

Validation

  • Pre-commit gate green on every commit (run inside nix develop to match CI's pinned
    terraform-docs): Terraform docs / fmt / Validate modules / trailing-whitespace.
  • Scorecard: no new violations.
  • SKE starterkit moved-blocks migration verified against live demo (0 replacements).
  • e2e tofu test needs a live meshStack + published provider, so it is left to CI / the smoke-test runner.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Scorecard Check

Scorecard run on commit 7ecf1336aef5313a99d84b02afd0913624446bc5 relative to origin/main

📊 meshstack-hub Module Scorecard

Generated: 2026-07-07 | Modules scanned: 11 | Categories: 5

📋 Per-Module Category Summary

Score per category per building block. n/a = category does not apply to this module.

Module Overall Core Structure Integration Azure Backplane STACKIT Backplane Testing
aks/starterkit 🟢 86% 🟢 100% 🟢 100% n/a n/a 🔴 0%
azure/azure-virtual-machine-starterkit 🔴 47% 🟡 57% n/a 🔴 44% n/a 🔴 33%
azure/budget-alert 🟢 100% 🟢 100% 🟢 100% 🟢 100% n/a 🟢 100%
azure/resource-group 🟢 100% 🟢 100% 🟢 100% 🟢 100% n/a 🟢 100%
azure/storage-account 🟢 100% 🟢 100% 🟢 100% 🟢 100% n/a 🟢 100%
meshstack/github-workflow 🟢 82% 🟡 50% 🟢 92% n/a n/a 🟢 100%
meshstack/manual 🟡 77% 🟡 50% 🟢 92% n/a n/a 🟡 67%
meshstack/noop 🟢 100% 🟢 100% 🟢 100% n/a n/a 🟢 100%
ske/ske-starterkit 🟢 95% 🟢 100% 🟢 100% n/a n/a 🟡 67%
stackit/git-repository 🟢 88% 🟢 100% 🟢 100% n/a 🔴 25% 🟢 100%
stackit/storage-bucket 🟢 96% 🟢 83% 🟢 100% n/a 🟢 100% 🟢 100%

⚠️ 7 modules have failing checks — failing categories are expanded below.

Core Structure — some checks failing

Basic module file structure and documentation — applies to 11 modules

Module Score 📦 🔗 📋 📝 🖼️ 📌 🔒
aks/starterkit 🟢 100%
azure/azure-virtual-machine-starterkit 🟡 57%
azure/budget-alert 🟢 100%
azure/resource-group 🟢 100%
azure/storage-account 🟢 100%
meshstack/github-workflow 🟡 50%
meshstack/manual 🟡 50%
meshstack/noop 🟢 100%
ske/ske-starterkit 🟢 100%
stackit/git-repository 🟢 100%
stackit/storage-bucket 🟢 83%

Core Structure — Summary

Emoji Criterion Coverage Status
📦 buildingblock/ directory exists 11/11 🟢 100%
🔗 meshstack_integration.tf present 10/11 🟢 91%
📋 buildingblock/APP_TEAM_README.md present (no-integration fallback) 0/1 🔴 0%
📝 buildingblock/README.md with YAML front-matter 11/11 🟢 100%
🖼️ buildingblock/logo.png included 8/11 🟡 73%
📌 buildingblock/versions.tf present 9/11 🟢 82%
🔒 Provider versions use minimum constraint (>=) 8/11 🟡 73%
Integration — some checks failing

meshstack_integration.tf conventions — applies to 10 modules

Module Score 🏷️ 🏢 📤 🔌 📎 🔀 📋 🏷️ 🧱 📖 📝 📊 🚫 🔄
aks/starterkit 🟢 100%
azure/budget-alert 🟢 100%
azure/resource-group 🟢 100%
azure/storage-account 🟢 100%
meshstack/github-workflow 🟢 92%
meshstack/manual 🟢 92%
meshstack/noop 🟢 100%
ske/ske-starterkit 🟢 100%
stackit/git-repository 🟢 100%
stackit/storage-bucket 🟢 100%

Integration — Summary

Emoji Criterion Coverage Status
🏷️ variable "hub" in integration 10/10 🟢 100%
🏢 variable "meshstack" in integration 10/10 🟢 100%
📤 building_block_definition output exposed 10/10 🟢 100%
🔌 meshcloud/meshstack in required_providers 10/10 🟢 100%
📎 backplane source uses var.hub.git_ref 10/10 🟢 100%
🔀 ref_name uses var.hub.git_ref 8/10 🟢 80%
📋 version_spec.draft uses var.hub.bbd_draft 10/10 🟢 100%
🏷️ BBD metadata.tags forwards var.meshstack.tags 10/10 🟢 100%
🧱 BBD input argument vars with optional() have explicit defaults 10/10 🟢 100%
📖 BBD readme field present 10/10 🟢 100%
📝 BBD readme starts with plain-text description (no heading) 10/10 🟢 100%
📊 BBD readme has shared responsibility table (✅/❌) 10/10 🟢 100%
🚫 No documentation_md output in backplane 10/10 🟢 100%
🔄 meshstack_platform has lifecycle ignore_changes = [availability] n/a
Azure Backplane — some checks failing

Azure UAMI-based automation principal conventions — applies to 4 modules

Module Score 🪪 🚫 🚫 🔑 🔗 🧹 📤 📍
azure/azure-virtual-machine-starterkit 🔴 44%
azure/budget-alert 🟢 100%
azure/resource-group 🟢 100%
azure/storage-account 🟢 100%

Azure Backplane — Summary

Emoji Criterion Coverage Status
🪪 Uses azurerm_user_assigned_identity 3/4 🟡 75%
🚫 No azuread_application resources 4/4 🟢 100%
🚫 No azuread_service_principal resources 4/4 🟢 100%
🔑 No azuread_application_password resources 4/4 🟢 100%
🔗 Uses azurerm_federated_identity_credential 3/4 🟡 75%
workload_identity_federation is non-nullable 3/4 🟡 75%
🧹 No create_service_principal_name toggle 4/4 🟢 100%
📤 Outputs identity (client_id, principal_id, tenant_id) 3/4 🟡 75%
📍 Integration has azure_location 3/4 🟡 75%
STACKIT Backplane — some checks failing

STACKIT WIF-based automation principal conventions — applies to 2 modules

Module Score 🔐 🚫 📤
stackit/git-repository 🔴 25%
stackit/storage-bucket 🟢 100%

STACKIT Backplane — Summary

Emoji Criterion Coverage Status
🔐 Uses stackit_service_account_federated_identity_provider 1/2 🟡 50%
🚫 No stackit_service_account_key resource 2/2 🟢 100%
📤 Outputs service_account_email (not key) 1/2 🟡 50%
Buildingblock provider uses use_oidc = true 1/2 🟡 50%
Testing — some checks failing

End-to-end test coverage — applies to 11 modules

Module Score ⚙️ 🧪
aks/starterkit 🔴 0%
azure/azure-virtual-machine-starterkit 🔴 33%
azure/budget-alert 🟢 100%
azure/resource-group 🟢 100%
azure/storage-account 🟢 100%
meshstack/github-workflow 🟢 100%
meshstack/manual 🟡 67%
meshstack/noop 🟢 100%
ske/ske-starterkit 🟡 67%
stackit/git-repository 🟢 100%
stackit/storage-bucket 🟢 100%

Testing — Summary

Emoji Criterion Coverage Status
⚙️ backplane/ directory (optional tier) 8/11 🟡 73%
🧪 e2e/ test directory exists 9/11 🟢 82%
e2e/ contains .tftest.hcl files 9/11 🟢 82%

📈 Overall Summary

Overall Average Score: 88%

Score Distribution

  • 🟢 High maturity (≥80%): 9 modules
  • 🟡 Medium maturity (50–79%): 1 modules
  • 🔴 Low maturity (<50%): 1 modules

@aws-amplify-eu-central-1

Copy link
Copy Markdown

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-215.d1o16zfeoh2slu.amplifyapp.com

@grubmeshi grubmeshi force-pushed the feature/migrate-to-building-block-v3 branch from a687810 to 2ab2787 Compare July 2, 2026 13:26
@grubmeshi grubmeshi changed the title refactor: migrate building blocks to meshstack_building_block (v3) refactor: migrate building blocks to meshstack_building_block Jul 2, 2026
@grubmeshi grubmeshi force-pushed the feature/migrate-to-building-block-v3 branch 2 times, most recently from 888f66c to 6d7891c Compare July 7, 2026 11:16
grubmeshi and others added 5 commits July 7, 2026 13:19
Migrate the app-team-managed child building blocks in the aks, azure-vm and ske
starterkits from the deprecated meshstack_building_block_v2 to meshstack_building_block.

- Convert per-type inputs (value_string/value_int/value_bool/...) to the unified
  value = jsonencode(...) shape; CODE inputs are double-encoded per the terraform
  runner contract (jsonencode(jsonencode({...}))).
- Read status.outputs via jsondecode(...value).
- Add moved{} blocks so the live blocks migrate in place (no destroy/recreate).
- Bump the meshstack provider constraint to >= 0.23.0 and regenerate READMEs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Switch every e2e smoke-test building block from meshstack_building_block_v2 to
meshstack_building_block, converting inputs to value = jsonencode(...) / sensitive
blocks and rewriting the .tftest.hcl assertions to read outputs via jsondecode(...value)
(CODE/JSON outputs decode twice). No moved{} blocks — e2e runs in ephemeral test state.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…put shape

Update the e2e-test skill to use meshstack_building_block, the value = jsonencode(...) /
sensitive input shape, and jsondecode(...value) output reads.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Under v2, `value_string = os == "Linux" ? key : null` omitted the input when
null. Migrated verbatim to v3, `value = jsonencode(... : null)` instead resolves
to the string "null" and the provider marshals that to an explicit JSON null,
sending it to the backend. Build inputs via merge() so ssh_public_key /
admin_password are only present for the matching OS, restoring the omit-on-null
behavior.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
main's endpoint-probe data source (added after this branch was cut) referenced
meshstack_building_block_v2.this; the e2e resource is now meshstack_building_block.this.
Point the probe at the v3 resource and jsondecode the output value. Surfaced when
rebasing the migration onto current main.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@grubmeshi grubmeshi force-pushed the feature/migrate-to-building-block-v3 branch from 6d7891c to c4c225b Compare July 7, 2026 11:22
@grubmeshi grubmeshi merged commit c4c225b into main Jul 7, 2026
2 of 3 checks passed
@grubmeshi grubmeshi deleted the feature/migrate-to-building-block-v3 branch July 7, 2026 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant